<!DOCTYPE html>
<html>
<head>
<title>购物车</title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- <link href="__PUBLIC__/Home/css/style.css" rel='stylesheet' type='text/css' /> -->
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
		function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //for-mobile-apps -->
<link href="__PUBLIC__/Home/Cart_css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="__PUBLIC__/Home/Cart_css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- font-awesome icons -->
<link href="__PUBLIC__/Home/Cart_css/font-awesome.css" rel="stylesheet"> 
<!-- //font-awesome icons -->
<!-- js -->
<script src="__PUBLIC__/Home/Cart_js/jquery-1.11.1.min.js"></script>
<!-- //js -->
<link href='http://fonts.googleapis.com/css?family=Raleway:400,100,100italic,200,200italic,300,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
<!-- start-smoth-scrolling -->
<script type="text/javascript" src="__PUBLIC__/Home/Cart_js/move-top.js"></script>
<script type="text/javascript" src="__PUBLIC__/Home/Cart_js/easing.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function($) {
		$(".scroll").click(function(event){		
			event.preventDefault();
			$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
		});
	});
</script>
<style>
	.footer1{
		background-color: black;
	}
</style>
<!-- start-smoth-scrolling -->
</head>
	
<body>
<!-- header -->
	<div class="agileits_header">
		<div class="container">
			<div class="w3l_offers">
				<p>请选择你喜欢的鞋子 <a href="{:U('Home/Index/index')}">SHOP</a></p>
			</div>
			<div class="agile-login">
				<ul>
					<notempty name="Think.session.user_name">
						<li style="color:#aeb2b7;">{$Think.session.user_name}</li>
						<li><a href="{:U('Home/Index/index')}?id=1" >，退出登陆</a></li>
						<else/>
						<li><a href="{:U('Home/Login/login')}">登陆</a><span> </span></li>
						<li><a href="{:U('Home/Register/register')}">注册</a></li>
					</notempty>			
				</ul>
			</div>
			<div class="product_list_header">  
					<form action="#" method="post" class="last"> 
						<input type="hidden" name="cmd" value="_cart">
						<input type="hidden" name="display" value="1">
						<button class="w3view-cart" type="submit" name="submit" value=""><i class="fa fa-cart-arrow-down" aria-hidden="true"></i></button>
					</form>  
			</div>
			<div class="clearfix"> </div>
		</div>
	</div>

	<div class="logo_products">
		<div class="container">
		<div class="w3ls_logo_products_left1">
				<ul class="phone_email">
					<li><i class="fa fa-phone" aria-hidden="true"></i>Order online or call us : (+0123) 234 567</li>
					
				</ul>
			</div>
			<div class="clearfix"> </div>
		</div>
	</div>
<!-- //header -->
<!-- navigation -->

		
<!-- //navigation -->
<!-- breadcrumbs -->
	<div class="breadcrumbs">
		<div class="container">
			<ol class="breadcrumb breadcrumb1">
				<li><a href="{:U('Home/Index/index')}"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>主页</a></li>
				<li class="active">购物车</li>
			</ol>
		</div>
	</div>
<div class="checkout">
    <div class="container">
        <div><h2>确认收货地址:</h2></div>
        <div class="checkout-right">
            <table>
                <td><input type="radio" name="" value=""></td>
            </table>
        </div>
        <div ><a href="#" onclick="add({$Think.session.user_name})">管理收货地址</a></div>

        <div class="checkout-left">
            <div class="clearfix"> </div>
        </div>
    </div>
</div>
<!-- //breadcrumbs -->
<!-- checkout -->
	<div class="checkout">
		<div class="container">
			<h2>确认您的订单信息:<span>{$re}件商品</span></h2>
			<div class="checkout-right">
				<table class="timetable_sub">
					<thead>
						<tr>
							<th>序列</th>	
							<th>商品图片</th>
							<th>数量</th>
							<th>商品名称</th>
							<th>价格</th>
							<th>总价格</th>
							<th>删除</th>
						</tr>
					</thead>
					<foreach name="arr" item="v">
					<tr class="rem1">
						<td class="invert">{$v.cart_id}</td>
						<td class="invert-image"><a href="single.html"><img src="__PUBLIC__/Uploads/{$v.cart_wares_images}" alt=" " class="img-responsive" /></a></td>
						<td class="invert">
							 <div class="quantity"> 
								<div class="quantity-select">                           
									<div class="entry value-minus">&nbsp;</div>
									<div class="entry value" id="value1{$v.cart_id}"><span class="value1{$v.cart_id}">1</span></div>
									<div class="entry value-plus active">&nbsp;</div>
								</div>
							</div>
						</td>
						<td class="invert">{$v.cart_wares_entry_name}</td>
						<td class="invert " id="num1{$v.cart_id}">{$v.cart_price}</td>
						<td class="invert " id="num2{$v.cart_id}">{$v.cart_price}</td>
						<td class="invert">
							<div class="rem">
								<div class="close1" onclick="cart_del({$v['cart_id']})"> </div>
							</div>
						</td>
					</tr>
					</foreach>
				</table>
			</div>
			<div class="checkout-left">	
				<div class="checkout-left-basket">
					<ul>
						<li>总价<i>-</i> <span id="num3"></span></li>
					</ul>
				</div>
				<div class="checkout-right-basket">
					<a href="single.html"><span ></span>提交订单</a>
				</div>
				<div class="clearfix"> </div>
			</div>
		</div>
	</div>
<div style="display:none;" id="add">
    <table cellpadding="0" cellspacing="0" class="layui-table" style="width:400px" lay-skin="row">
        <tr>
            <td>省/市/区</td>
            <td>
                <select  onchange="refer()">
                    <option>请选择</option>
                    <foreach name="re" item="v">
                        <option class="addr_one" value="{$v.address_id}">{$v.address_name}</option>
                    </foreach>
                </select>
                <select>
                    <foreach name="refer_one" item="v">
                            <option class="addr_two" value="{$v.address_id}">{$v.address_name}</option>
                    </foreach>
                </select>
                <select onchange="demand()">
                    <option value=""></option>
                </select>
            </td>
        </tr>
        <tr>
            <td>详细地址添加:</td>
            <td>
                <input type="text" name="order_addr" id="order_addr">
            </td>
        </tr>
    </table>
</div>
									<!--quantity-->
									<script>
										$(document).ready(function(){
											zongjia();
                                        })
									$('.value-plus').on('click', function(){
										var divUpd = $(this).parent().find('.value'), newVal = parseInt(divUpd.text(), 10)+1;
										divUpd.text(newVal);
										zongjia();
									});	

									$('.value-minus').on('click', function(){
										var divUpd = $(this).parent().find('.value'), newVal = parseInt(divUpd.text(), 10)-1;
										if(newVal>=1) divUpd.text(newVal);
										zongjia();
									});
									function zongjia(){
										var jiage=0;
										var price=0;
							            <foreach name="arr" item="v">
							            jiage=$("#num1{$v.cart_id}").html()*$("#value1{$v.cart_id}").text();
							            $("#num2{$v.cart_id}").html(jiage);
							            price+=$("#num1{$v.cart_id}").html()*$("#value1{$v.cart_id}").text();
							            $("#num3").html(price);
							            </foreach>

							        }
									</script>

								<!--quantity-->
<!-- //checkout -->
<!-- //footer -->
<!-- //footer -->	
<!-- Bootstrap Core JavaScript -->
<script src="__PUBLIC__/Home/Cart_js/bootstrap.min.js"></script>
<!-- top-header and slider -->
<!-- here stars scrolling icon -->
	<script type="text/javascript">
		$(document).ready(function() {
			/*
				var defaults = {
				containerID: 'toTop', // fading element id
				containerHoverID: 'toTopHover', // fading element hover id
				scrollSpeed: 1200,
				easingType: 'linear' 
				};
			*/
								
			$().UItoTop({ easingType: 'easeOutQuart' });
								
			});
	</script>
<!-- //here ends scrolling icon -->
<script src="__PUBLIC__/Home/Cart_js/minicart.min.js"></script>
<script>
	// Mini Cart
	paypal.minicart.render({
		action: '#'
	});

	if (~window.location.search.indexOf('reset=true')) {
		paypal.minicart.reset();
	}
</script>
<!-- main slider-banner -->
<script src="__PUBLIC__/Home/Cart_js/skdslider.min.js"></script>
<link href="__PUBLIC__/Home/Cart_css/skdslider.css" rel="stylesheet">
<script type="text/javascript">
		jQuery(document).ready(function(){
			jQuery('#demo1').skdslider({'delay':5000, 'animationSpeed': 2000,'showNextPrev':true,'showPlayButton':true,'autoSlide':true,'animationType':'fading'});
						
			jQuery('#responsive').change(function(){
			  $('#responsive_wrapper').width(jQuery(this).val());
			});
			
		});
</script>	
<!-- //main slider-banner -->
<link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css">
<script src="__PUBLIC__/layui/layui.js"></script>
<script>
    function cart_del(id) {
        layui.use('layer',function(){
            var layer = layui.layer;
            $.post('cart_del','id='+id,function (data) {
                if (data == 1){
                    layer.msg('购物车删除成功',{icon:6,time:1000},function () {
                        location.href=location.href;
                    })
                }else{
                    layer.msg('购物车删除失败',{icon:7,time:1000},function () {
                        location.href=location.href;
                    })
                }
            })
        })
    }
    function  add(id){
        layui.use('layer', function () {
            layer.open({          // 普通信息弹窗
                type:1,
                title:'添加收货地址',
                content:$("#add"),
                shadeClose:true,
                area:['500px','200px'],
                btn:['确定','取消'],
                btn1: function (index) {
                    $.post('add','id='+id+'&group_id='+$('#group_id').val(),function(data){
                        if(data == 1){
                            layer.close(index);
                            layer.msg('修改成功',{icon:6,time:1000},function(){
                                location.href = location.href;
                                console.log(data);
                            })
                        }else{
                            layer.msg('修改失败',{icon:7,time:1000});
                            console.log(data);
                        }
                    })
                },  
                btn2: function () {
                    layer.msg('取消修改',{icon:7,time:2000})
                }
            });
        })
    }
    function refer() {
        $.post('refer_one','id='+$('.addr_one').val(),function (data) {
            if(data==1){
                console.log(data);
            }
        })
    }
</script>
</body>
</html>